<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>合同列表</title>
<%@include file="/skins/jsp/loadCss.jsp"%>
</head>
<body>
	<h2>合同列表</h2>
	<p class="ch-form-actions" style="float: right;margin-bottom: 5px;">
		<s:form method="POST">
			<s:hidden name="selectTrue" value="true"/>
			合同号：<s:textfield name="cttNo"></s:textfield>
			公司名称：<s:textfield name="cctCustomer"></s:textfield>
			收款情况：<s:select  name="payType" list="#{'-1':'请选择','1':'款已结','0':'未结款'}"></s:select>
			发货情况：<s:select  name="sendType" list="#{'-1':'请选择','1':'已到货','0':'未到货'}"></s:select>
			发票开具情况：<s:select  name="invType" list="#{'-1':'请选择','1':'已处理','0':'未处理'}"></s:select>
			客户确认情况：<s:select  name="customerType" list="#{'-1':'请选择','1':'盖章确认','0':'未确认'}"></s:select>
			<s:submit value="查询合同" cssClass="ch-btn ch-btn-small"></s:submit>
		</s:form>
		<s:a action="findContract" namespace="/contract"
			cssClass="ch-btn ch-btn-small">新增合同</s:a>
	</p>
	<table class="ch-datagrid">
		<thead>
			<tr>
				<th align="center" width="4%">序号</th>
				<th width="8%">合同号</th>
				<th width="14%">公司</th>
				<th width="4%">公司性质</th>
				<th width="6%">付款方式</th>
				<th width="6%">负责人</th>
				<th width="8%">日期</th>
				<th width="5%">收款</th>
				<th width="5%">发货</th>
				<th width="5%">发票</th>
				<th width="6%">客户确认</th>
				<th width="5%" style="text-align: center;">已付</th>
				<th width="5%" style="text-align: center;">未付</th>
				<th width="5%" style="text-align: center;">总额</th>
				<th width="10%">操作</th>
			</tr>
		</thead>
		<tbody>
			<s:iterator value="contractList" status="st">
				<tr <s:if test="#st.isEven()">style="BACKGROUND: #f8f8f8"</s:if>>
					<td align="center"><s:property value="%{#st.count}" /></td>
					<td><s:a action="findContractView" namespace="/contract">
							<s:param name="cttId" value="cttId"></s:param>
							<s:property value="cttNo" />
						</s:a>
					</td>
					<td><s:property value="cctCustomer" /></td>
					<td><s:if test="comKind==\"1\"">
							未知
						</s:if> <s:elseif test="comKind==\"2\"">客户</s:elseif> <s:else>
							分销
						</s:else>
					</td>
					<td><s:if test="payMode==\"00\"">先货后款</s:if> <s:elseif
							test="payMode==\"01\"">10%预付</s:elseif> <s:elseif
							test="payMode==\"02\"">20%预付</s:elseif> <s:elseif
							test="payMode==\"03\"">30%预付</s:elseif> <s:elseif
							test="payMode==\"04\"">40%预付</s:elseif> <s:elseif
							test="payMode==\"05\"">50%预付</s:elseif> <s:elseif
							test="payMode==\"06\"">60%预付</s:elseif> <s:elseif
							test="payMode==\"07\"">70%预付</s:elseif> <s:elseif
							test="payMode==\"08\"">80%预付</s:elseif> <s:elseif
							test="payMode==\"09\"">90%预付</s:elseif> <s:elseif
							test="payMode==\"10\"">100%预付</s:elseif> <s:elseif
							test="payMode==\"11\"">先预付再尾款再货</s:elseif> <s:elseif
							test="payMode==\"12\"">先开发票再款再货</s:elseif> <s:elseif
							test="payMode==\"13\"">先开发票再货再款</s:elseif> <s:elseif
							test="payMode==\"14\"">样品外借须押金</s:elseif> <s:elseif
							test="payMode==\"15\"">样品外借无押金</s:elseif>
					</td>
					<td><s:property value="cttBUserName" />
					</td>
					<td><s:property value="addDate" />
					</td>
					<td>
						<s:if test="payType==\"1\"">
							<font color="green">款已结</font>
						</s:if> 
						<s:else>
							<s:if test="userInfo.userId<0">
									<s:a action="findContractPaid" namespace="/contract"
										cssClass="ch-btn ch-btn-small">
										<s:param name="cttId" value="cttId"></s:param>
								结款</s:a>
							</s:if>
							<s:else>
								<font color="red">款未结</font>
							</s:else>
						</s:else>
					</td>
					<td>
						<s:if test="sendType==\"1\"">
							<font color="green">已到货</font>
						</s:if> 
						<s:else>
							<s:if test="userInfo.userId<0">
								<s:a action="updateContractBysendType" namespace="/contract"
									cssClass="ch-btn ch-btn-small">
									<s:param name="cttId" value="cttId"></s:param>
							到货</s:a>
							</s:if>
							<s:else>
								<font color="red">未到货</font>
							</s:else>
						</s:else>
					</td>
					<td>
						<s:if test="invType==\"1\"">
							<font color="green">已处理</font>
						</s:if> 
						<s:else>
							<s:if test="userInfo.userId<0">
								<s:a action="updateContractByinvType" namespace="/contract"
									cssClass="ch-btn ch-btn-small">
									<s:param name="cttId" value="cttId"></s:param>
							确认</s:a>
							</s:if>
							<s:else>
								<font color="red">未处理</font>
							</s:else>
						</s:else>
					</td>
					<td><s:if test="customerType==\"1\"">
							<font color="green">盖章确认</font>
						</s:if> <s:else>
							<s:a action="updateContractBycustomerType" namespace="/contract"
								cssClass="ch-btn ch-btn-small">
								<s:param name="cttId" value="cttId"></s:param>
							确认</s:a>
						</s:else>
					</td>
					<td align="center"><s:property value="paidOn" />
					</td>
					<td align="center"><s:property value="paidOff" />
					</td>
					<td align="center"><s:property value="amount" />
					</td>
					<td>
						<s:a action="findContract" namespace="/contract">
							<s:param name="cttId" value="cttId">
							</s:param>
							<i class="ch-icon-pencil editBtn" title="修改合同"></i>
						</s:a>
						<s:if test="userInfo.userId<0">
								<i class="ch-icon-remove" style="cursor: pointer;" onclick="delCue('<s:property value="cttId" />')" title="删除合同"></i>
						</s:if>
						<s:if test="customerType!=\"1\"">
							<s:a action="findCGoods" namespace="/contract" cssClass="ch-btn ch-btn-small"><s:param name="cttId" value="cttId"/>合同产品</s:a>
						</s:if>
					</td>
				</tr>
			</s:iterator>
		</tbody>
	</table>
	<%@include file="/skins/jsp/loadJquery.jsp"%>
	<script type="text/javascript">
		var delCue = function(cttId){if(confirm("是否要删除此条记录！"))delContract(cttId)},delContract = function(cttId){window.location.href="<%=request.getContextPath()%>/contract/delContract.action?cttId=" + cttId};
	</script>
</body>
</html>